package com.pac.questionnaire.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.pac.questionnaire.bean.QuestionnaireAnswerFileBean;
import com.pac.questionnaire.dao.QuestionnaireAnswerFileDao;

/**
 * 问卷回答附件dao实现
 * 
 * @author lujun.chen
 * @version [版本号, 2015年3月9日]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
@Repository(value = "questionnaireAnswerFileDao")
public class QuestionnaireAnswerFileDaoImpl implements
		QuestionnaireAnswerFileDao {

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public String addQuestionnaireAnswerFile(
			QuestionnaireAnswerFileBean questionnaireAnswerFileBean) {
		sqlSessionTemplate.insert("addQuestionnaireAnswerFile",
				questionnaireAnswerFileBean);
		return questionnaireAnswerFileBean.getId();
	}

	@Override
	public boolean delQuestionnaireAnswerFile(
			QuestionnaireAnswerFileBean questionnaireAnswerFileBean) {
		int n = sqlSessionTemplate.delete("delQuestionnaireAnswerFile",
				questionnaireAnswerFileBean);
		return n > 0;
	}

	@Override
	public List<QuestionnaireAnswerFileBean> queryQuestionnaireAnswerFile(
			QuestionnaireAnswerFileBean questionnaireAnswerFileBean) {
		return sqlSessionTemplate.selectList("queryQuestionnaireAnswerFile",
				questionnaireAnswerFileBean);
	}

}
